<?php get_instance()->view('common/header'); $info = $tData['merchant']; $profile = $tData['profile'];?>
<body>
    <div class="shopinfoheader" <?php if (empty($tData['promotion'])):?> style="padding-bottom: 1em;" <?php endif;?>>
        <div class=" hengleft vCenter m0_10 pr">
            <div class="imgbox mr10"><img src="<?php echo $info['portrait']?>" alt=""></div>
            <div class="model wp100" >
                <div class="heng vCenter pr pr10">
                    <p class="mr5 lh10  f10 fb ">
                        <?php echo $info['shop_name']?>

                    </p>
                    <div>
                        <a href="<?php echo getUrl('home/search?merchant_id='.$merchantId)?>">
                            <img style="width: 1.35em;right: 4.5em;" class="fr pos" src="<?php echo $this->staticUrl?>img/png/pic150.png" alt="">
                        </a>
                    <?php if ($tData['is_Collection'] == 1):?>
                        <img style="width: 1.5em;right:2.25em;" class="fl pos coll collect" src="<?php echo $this->staticUrl?>img/png/pic141-2.png" alt="">
                    <?php else:?>
                        <img style="width: 1.5em;right:2.25em;" class="fl pos coll collect" src="<?php echo $this->staticUrl?>img/png/pic141.png" alt="">
                    <?php endif;?>

                        <a href="<?php echo getUrl('common/merchantMap?shop_name='.$info['shop_name'].'&mobile='.$profile['mobile'].'&lat='.$info['latitude']).'&lng='.$info['longitude']?>">
                            <img style="width: 1.35em;right:0;" class="fr pos" src="<?php echo $this->staticUrl?>img/png/pic51.png" alt="">
                        </a>
                    </div>
                </div>
                <div class="hengleft f08 mt5 mb5 vCenter wp100">
                    <span class="f08 ">共<?php echo $info['total_product']?>件商品</span>

                    <?php if($business_desc):?>
                        <span style="padding-left:5px;font-size: 1.0em;">[<?php echo $business_desc?>]</span>
                    <?php endif;?>

                    <?php if ($profile['business'] == 1):?>
                        <span class="f08  ml10">
                            <img class="heightimg di mr5" src="<?php echo $this->staticUrl?>img/png/pic16.png" alt="">
                            休息中
                        </span>
                    <?php endif;?>
                </div>
                <div class="hengleft vCenter f08">
                    <p class="f08 "><?php echo $info['address']?></p>
                </div>
            </div>
        </div>
        <?php if (!empty($tData['promotion'])):?>
            <div class="swiper-container shopinxban">
                <div class="swiper-wrapper">
                    <?php foreach ($tData['promotion'] as $pk => $pv):?>
                        <div class="swiper-slide" ><img src="<?php echo $this->staticUrl?>img/png/pic91.png" alt=""><?php echo $pv?></div>
                    <?php endforeach;?>
                </div>
            </div>
        <?php endif;?>
    </div>

<script type="text/javascript">
    $(function () {
        var is_collection = "<?php echo $tData['is_Collection']?>",
            merchantId = "<?php echo $merchantId?>",
            a = "<?php echo $this->staticUrl?>img/png/pic141-2.png",
            l = "<?php echo $this->staticUrl?>img/png/pic141.png";
        /**
         * 点击收藏
         */
        $(".shopinfoheader").delegate('.collect', 'click', function () {
            var _this = $(this),
                url;
            if (is_collection == 2){
                url = '<?php echo getUrl('user/rmCollection');?>';
            }else{
                url = '<?php echo getUrl('user/saveCollection');?>';
            }
            $.ajax(url, {
                type:'post',
                data:{relation_id:merchantId,type:1},
                dataType:'json',
                error:function(){
                    show_message({status:0, message:'请求超时'});
                },
                timeout:60000,
                success:function(e,textStatus,jqXHR){
                    show_message(e);
                    if (e.status != 1){
                        return;
                    }
                    if (is_collection == 2){
                        is_collection = 1;
                        $(".coll").attr('src', a);
                    }else{
                        is_collection = 2;
                        $(".coll").attr('src', l);
                    }
                }
            });
        });
    })
</script>
<style>
    .miaoshabox:after{content:'秒杀';text-align:center;width:4em;background:red;color:#fff;position:absolute;left:0;top:0;font-size:0.5em;}
</style>
<div class="shopshow" style="display:none;">
    <div class="saixuan saixuanfix threesai">
        <a href="javascript:;" class="actived">商品</a>
        <a href="javascript:;" >店铺</a>
        <a href="javascript:;" >评价</a>
        <div class="after"></div>
    </div>
    <div class="shopshowcons">
        <!--产品信息-->
        <div class="swiper-slide-item">
            <div class="consmodel">
            	<script type="text/javascript">
					$(function(){
						var list = eval('(<?php echo json_encode($list);?>)');
						var left = '';
						var right = '';

						$.each(list, function(k,v){

							left += '<li>'+v.cat_name+'</li>';	

							right += '<li>';
							right += '<div class="class-title">'+v.cat_name+'</div>';

							$.each(v.product, function(k,v){
                                var addclass = '';
                                if(v['is_special'] == 2){
                                    addclass = ' pr miaoshabox';
                                }
								right += '<div class="itemmodel" >';
								right += '<a href="<?php echo getUrl('product/info?merchant_id='.$merchantId)?>&product_id='+v.id+'">';
								right += '<div class="item-left">';
								right += '<div class="item-img '+addclass+'">';
								right += '<img src="<?php echo getImage('', 'xs');?>" originalSrc="'+v.icon.xs+'" alt="">';
								right += '</div>';
								right += '</div>';
								right += '</a>';
								right += '<div class="item-right">';
								right += '<div class="mltitle">'+v.name+'</div>';
								right += '<div class="subtitle">销量：'+v.sale_quantity+'</div>';
								right += '<div class="price">';
								right += '<span class="xian">¥ '+v.goods_price+'</span>';
								if(v.market_price > 0){
                                    right += '<span class="yuan">¥ '+v.market_price+'</span>';
                                }
								right += '</div>';
								right += '<div class="zengjian zj quantity'+v.id+'" data-id="'+v.id+'" data-sort="0">';
								if(v.property.length==0 && v.tags.length==0){
									if(v.u_quantity > 0){
										right += '<span class="min"></span>';
										right += '<span class="zi">'+v.u_quantity+'</span>';
									}
									right += '<span class="add"></span>';
								}else{
									right += '<span class="guige"></span>';
								}
                                right += '</div>';
                                right += '</div>';
                                right += '</div>';
							});
							right += '</li>';
						});

						$('#left ul').html(left);
						$('#right ul').html(right);

						$('.shopshow').show();
				        $('.consmodel').css('height', $('.consright').height());

				        var winHeight = $(window).height();
				        $('.consright').css('height', $('.consright').height());
				    	$('.consleft ul li').eq(0).addClass('active');
				    	window.onscroll = function() {
				    		scoorll();	
					    }
				    	$('.consleft ul li').click(function(){
				    		var i = $(this).index('.consleft ul li');
				    		$('body, html').animate({scrollTop:$('.consright ul li').eq(i).offset().top-40},500);
				    	});
					});
            	</script>
                <div class="consleft" id="left">
                    <ul>
                        
                    </ul>
                </div>
                <div class="consright" id="right">
                    <div class="swiper-container shopbanner">
                        <div class="swiper-wrapper">
                            <?php foreach ($profile['shop_ads'] as $pk => $pv):?>
                                <div class="swiper-slide">
                                    <a href="<?php if($pv['id']){echo getUrl('product/info?product_id='.$pv['id'].'&merchant_id='.$merchantId);}else{echo 'javascript:;';}?>">
                                    <img src="<?php echo $pv['adpic']?>" class="wp100" alt="" style="height: 108.64px">
                                    </a>
                                </div>
                            <?php endforeach;?>
                        </div>
                    </div>
                    <ul>
                        
                    </ul>
                </div>
            </div>
            <!--购物车-->
            <?php get_instance()->view('product/shopCar.php');?>
        </div>
        <!--店铺信息-->
        <div class="swiper-slide-item bag3" style="display:none;">
            <div class="p3p mb10 bag1">
                <p class="clear vCenter mb5 f08"><label class="cor6 fl">营业时间：</label>
                    <?php echo $profile['business_time']?>
                    <!--<?php echo $profile['business_week']?>-->
                </p>
                <p class="clear vCenter mb5 f08"><label class="cor6 fl">联系电话：</label><?php echo $profile['mobile']?></p>
                <p class="clear vCenter mb5 f08"><label class="cor6 fl">运营模式：</label>
                    <?php if ($profile['s_type']['dian'] == 2):?> <span class="dian fl"></span> <?php endif;?>
                    <?php if ($profile['s_type']['song'] == 2):?> <span class="song fl"></span> <?php endif;?>
                    <?php if ($profile['s_type']['cheng'] == 2):?> <span class="cheng fl"></span> <?php endif;?>
                </p>
            </div>
            <div class="p3p mb10 bag1">
                <div class="menutitle"><i class="line"></i>营业资质<label class="en ml5">Business qualification</label></div>
                <div class="businessQuabox">
                    <div class="businessQuaboxItem imgbox"><img src="<?php echo $profile['license']['og']?>" alt=""></div>
                </div>
            </div>
            <?php if (!empty($profile['shop_imgs'])):?>
                <div class="p3p mb10 bag1">
                    <div class="menutitle"><i class="line"></i>商家实景<label class="en ml5">Business real scene</label></div>
                    <div class="businessScene imgboxpull">
                        <?php foreach ($profile['shop_imgs'] as $k => $v):?>
                            <div class="businessSceneItem imgbox"><img src="<?php echo $v?>" alt=""></div>
                        <?php endforeach;?>
                    </div>
                </div>
            <?php endif;?>
        </div>
        <!--评论信息-->
        <div class="swiper-slide-item" style="display:none;">
            <div class="p15_0 bor_bb hengleft vCenter">
                <div class="fenzi">
                    <span class="dk tc"><?php echo $comment['total_score']?></span>
                    <p class="">综合评分</p>
                </div>
                <div>
                    <div class="hengleft m5_0">
                        <p class="mr10">服务评价</p>
                        <div class="xing heng vCenter">
                            <?php for ($i = 0; $i < $comment['service']; $i++):?>
                                <img src="<?php echo $this->staticUrl?>img/png/pic11.png" alt="">
                            <?php endfor; $sc = 5 - $comment['service']; for ($j = 0; $j < $sc; $j++):?>
                                <img src="<?php echo $this->staticUrl?>img/png/pic12.png" alt="">
                            <?php endfor;?>
                        </div>
                    </div>
                    <div class="hengleft m5_0">
                        <p class="mr10">商品评分</p>
                        <div class="xing heng vCenter">
                            <?php for ($p = 0; $p < $comment['product']; $p++):?>
                                <img src="<?php echo $this->staticUrl?>img/png/pic11.png" alt="">
                            <?php endfor; $pc = 5 - $comment['product']; for ($f = 0; $f < $pc; $f++):?>
                                <img src="<?php echo $this->staticUrl?>img/png/pic12.png" alt="">
                            <?php endfor;?>
                        </div>
                    </div>
                </div>
            </div>
            <?php if (!empty($comment['desc'])):?>
                <div class="waper m0a hengline vCenter bqwp3box bor_bb">
                    <?php foreach ($comment['desc'] as $dk => $dv):?>
                        <b class="bqwp3"><?php echo $dv['tags'].'('.$dv['count'].')'?></b>
                    <?php endforeach;?>
                </div>
            <?php endif;?>
            <?php if (!empty($comment['list'])):?>
                <div class="list">
                    <?php foreach ($comment['list'] as $ck => $cv):?>
                        <div class="userhuifu bor_bb">
                            <div class="hengleft">
                                <div class="minuserimg imgbox"><img src="<?php echo $cv['headurl']?>" alt=""></div>
                                <div class="">
                                    <h1><?php echo $cv['name']?></h1>
                                    <p class="f07 pjdatatime"><?php echo $cv['addtime']?></p>
                                </div>
                            </div>
                            <div class="huifu">
                                <p class="m5_0 f09"><?php echo $cv['content']?></p>
                                <?php if (!empty($cv['imgs'])):?>
                                    <div class="huifuimgbox imgboxpull">
                                        <?php foreach ($cv['imgs'] as $cik => $civ):?>
                                            <div class=" imgbox"><img src="<?php echo $civ?>" alt=""></div>
                                        <?php endforeach;?>
                                    </div>
                                <?php endif;?>
                                <?php if (isset($cv['desc'])):?>
                                    <p class="textEll  cor9">
                                        <span class="f08 mr15"><?php echo $cv['desc']?></span>
                                    </p>
                                <?php endif;?>
                            </div>
                            <?php if (!empty($cv['reply'])):?>
                                <div class="shophuifu">
                                    <span>店家回复：</span><?php echo $cv['reply']?>
                                </div>
                            <?php endif;?>
                            <div class="xing heng vCenter">
                                <?php for ($w = 0; $w < $cv['score']; $w++):?>
                                    <img src="<?php echo $this->staticUrl?>img/png/pic11.png" alt="">
                                <?php endfor; $xw = 5 - $cv['score']; for ($x = 0; $x < $xw; $x++):?>
                                    <img src="<?php echo $this->staticUrl?>img/png/pic12.png" alt="">
                                <?php endfor;?>
                            </div>
                        </div>
                    <?php endforeach;?>
                </div>
            <?php else:?>
                <div class="statebox chuizhi jdjz" style="flex: 1;height: 100%;">
                    <img class="stateimgda mb5" src="<?php echo $this->staticUrl?>img/default/2.png" alt="">
                    <span class="f09 cor9 tc mb20">暂无评论</span>
                </div>
            <?php endif;?>
        </div>
    </div>
</div>
<?php get_instance()->view('product/guiGe.php'); ?>
</body>
<script src="<?php echo $this->staticUrl?>js/imgLazyLoading.min.js"></script>
<script src="<?php echo $this->staticUrl?>js/base.js?v=1.0"></script>
<script type="text/javascript">
    $(function () {
        var needRefresh = sessionStorage.getItem("need-refresh");
        if(needRefresh){
            sessionStorage.removeItem("need-refresh");
            location.reload();
        }

        $("img").delayLoading({
            //defaultImg: "__PUBLIC__/images/img/loading.gif",      // 预加载前显示的图片
            errorImg: "",            // 读取图片错误时替换图片(默认：与defaultImg一样)
            imgSrcAttr: "originalSrc",      // 记录图片路径的属性(默认：originalSrc，页面img的src属性也要替换为originalSrc)
            beforehand: 0,            // 预先提前多少像素加载图片(默认：0)
            event: "scroll",           // 触发加载图片事件(默认：scroll)
            duration: "normal",         // 三种预定淡出(入)速度之一的字符串("slow", "normal", or "fast")或表示动画时长的毫秒数值(如：1000),默认:"normal"
            container: window,          // 对象加载的位置容器(默认：window)
            success: function (imgObj) { },   // 加载图片成功后的回调函数(默认：不执行任何操作)
            error: function (imgObj) { }     // 加载图片失败后的回调函数(默认：不执行任何操作)
         });
    });

    var btn = 1;
    function scoorll(){

    	 if($(window).scrollTop() > 1){
 		 	$('.saixuanfix').css({'position':'fixed', 'zIndex':'10000'});
 		 	$('.consleft').css({'position':'fixed','height':'85%','overflow':'auto', 'top':"44px"});
 		 	$('.consright').css('margin-left',$('.consleft').width());
 		 	$('.shopinfoheader').hide();
 		 	$('.shopshow').css('margin-top', $('.saixuanfix').height());
 		 	if(btn == 1){
 		 	 	$('body').animate({scrollTop:2}, 'fast');
 		 	 	btn = 2;
 		 	}
 		 }else {
 		 	$('.consleft').css('top','');
 		 	$('.saixuanfix').css('position','');
 		 	$('.shopshow').css('marginTop','0');
 		 	$('.consleft').css('position','');
 		 	$('.consright').css('margin-left','');
 		 	$('.shopinfoheader').show();
 		 	btn = 1;
 		 };
 		//滚动到标杆位置,左侧导航加active
 		$('.consright ul li').each(function(){
 			var target = parseInt($(this).offset().top-$(window).scrollTop() - 80);
 			var i = $(this).index();
 			if (target<=0) {
 				$('.consleft ul li').removeClass('active');
 				$('.consleft ul li').eq(i).addClass('active');
 			}
 		});
    }
</script>
</html>